// FACTORY.h : Declaration of the FACTORY

#pragma once
#include "resource.h"       // main symbols
#include "StaticAlgorithmMetadata.h"
#include "ALGORITHM.h"

#include "Plugin.h"


// FACTORY

class ATL_NO_VTABLE FACTORY : 
	public CComObjectRootEx<CComMultiThreadModel>,
	public CComCoClass<FACTORY, &CLSID_FACTORY>,
	public ISupportErrorInfo,
	public IDMAlgorithmFactory,
	public IDMAlgorithmMetadata
{
public:
	FACTORY()
	{
	}

DECLARE_REGISTRY_RESOURCEID(IDR_FACTORY)


BEGIN_COM_MAP(FACTORY)
	COM_INTERFACE_ENTRY(IDMAlgorithmFactory)
	COM_INTERFACE_ENTRY(ISupportErrorInfo)
	COM_INTERFACE_ENTRY(IDMAlgorithmMetadata)
END_COM_MAP()

// ISupportsErrorInfo
	STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);

	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		return S_OK;
	}
	
	void FinalRelease() 
	{
	}

public:
	// IDMAlgorithmFactory

	STDMETHOD (CreateAlgorithm)(
			/* [in] */ 		IDMModelServices*	in_pContext,
			/* [out] */		IDMAlgorithm**		out_ppAlgorithm);

	IMPLEMENT_STATIC_ALGORITHM_METADATA(ALGORITHM)
};

OBJECT_ENTRY_AUTO(__uuidof(FACTORY), FACTORY)
